def uri_pathlist(p):
"""Split a path into a list.
- p path
+ p path
return list of path elements
"""
l = []
"""Get the method for an operation.
For operation 'foo' looks for 'op_foo'.
- op operation name
+ op operation name
returns method or None
"""
op_method_name = 'op_' + op
and an HTML string otherwise (or list).
Methods may also return a ThreadRequest (for incomplete processing).
- req request
+ req request
"""
op = req.args.get('op')
if op is None or len(op) != 1:
"""Create a constructor. It is assumed that the class
should be imported as 'from xen.xend.server.klass import klass'.
- klass name of its class
+ klass name of its class
"""
self.klass = klass
self.obj = None
def prettyprint(sxpr, out=sys.stdout, width=80):
"""Prettyprint an SXP form.
- sxpr s-expression
- out destination
- width maximum output width
+ sxpr s-expression
+ out destination
+ width maximum output width
"""
if isinstance(sxpr, types.ListType):
pp = SXPPrettyPrinter(width=width)
def prettyprintstring(sxpr, width=80):
"""Prettyprint an SXP form to a string.
- sxpr s-expression
- width maximum output width
+ sxpr s-expression
+ width maximum output width
"""
io = StringIO.StringIO()
prettyprint(sxpr, out=io, width=width)
if dev_uuid not in target['console_refs']:
target['console_refs'].append(dev_uuid)
- # Cope with old-format save files which say under vfb
- # (type vfb) rather than (vfb 1)
- try:
- vfb_type = dev_info['type']
- except KeyError:
- vfb_type = None
- log.debug("iwj dev_type=%s vfb type %s" %
- (dev_type, `vfb_type`))
-
- if vfb_type == 'vnc' or vfb_type == 'sdl':
- dev_info[vfb_type] = 1
- del dev_info['type']
- log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
- (dev_type, vfb_type))
+ # Cope with old-format save files which say under vfb
+ # (type vfb) rather than (vfb 1)
+ try:
+ vfb_type = dev_info['type']
+ except KeyError:
+ vfb_type = None
+ log.debug("iwj dev_type=%s vfb type %s" %
+ (dev_type, `vfb_type`))
+
+ if vfb_type == 'vnc' or vfb_type == 'sdl':
+ dev_info[vfb_type] = 1
+ del dev_info['type']
+ log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
+ (dev_type, vfb_type))
# Create serial backends now, the location value is bogus, but does not matter
i=0
chardev=0
"""Encode some data for HTTP transport.
The encoding used is stored in 'Content-Type' in the headers.
- d data - sequence of tuples or dictionary
+ d data - sequence of tuples or dictionary
returns a 2-tuple of the headers and the encoded data
"""
val = ({}, None)
return None
def _linux_balloon_stat(label):
- if os.access(PROC_XEN_BALLOON, os.F_OK):
- return _linux_balloon_stat_proc(label)
- elif os.access(SYSFS_XEN_MEMORY, os.F_OK):
- return _linux_balloon_stat_sysfs(label)
-
- return None
+ if os.access(PROC_XEN_BALLOON, os.F_OK):
+ return _linux_balloon_stat_proc(label)
+ elif os.access(SYSFS_XEN_MEMORY, os.F_OK):
+ return _linux_balloon_stat_sysfs(label)
+ return None
def _solaris_balloon_stat(label):
"""Returns the value for the named label, or None if an error occurs."""
if id.startswith(self.devid[:9]): # id's vendor and device ID match
skey = id.split(':')
size = len(skey)
- if (size == 2): # subvendor/subdevice not suplied
+ if (size == 2): # subvendor/subdevice not suplied
ret = True
break
- elif (size == 4): # check subvendor/subdevice
+ elif (size == 4): # check subvendor/subdevice
# check subvendor
subven = '%04x' % self.subvendor
if ((skey[2] != 'FFFF') and
def parse(io):
"""Completely parse all input from 'io'.
- io input file object
+ io input file object
returns list of values, None if incomplete
raises ParseError on parse error
"""
given DISPLAY and XAUTHORITY, which default to the current user's
ones. OpenGL will be used by default unless opengl is set to 0.
keymap overrides the XendD configured default layout file.
- Serial adds a second serial support to qemu.
+ Serial adds a second serial support to qemu.
Monitor adds a backend for the stubdom monitor.""")
gopts.var('vif', val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT," + \
for (k, v) in options:
if k in ['-q', '--quiet']:
quiet = True
- elif k in ['-n', '--num']:
- num = int(v[0])
+ elif k in ['-n', '--num']:
+ num = int(v[0])
else:
assert False
return
def f(x):
- # The vfunc shouldn't be used for ordering if the vslot hasn't been
- # assigned as the output looks odd beacuse the vfunc isn't reported
- # but the (physical) function is.
- if x['vdevfn'] & AUTO_PHP_SLOT:
- vdevfn = AUTO_PHP_SLOT
- else:
- vdevfn = x['vdevfn']
- return (vdevfn << 32) | \
- PCI_BDF(x['domain'], x['bus'], x['slot'], x['func'])
+ # The vfunc shouldn't be used for ordering if the vslot hasn't been
+ # assigned as the output looks odd beacuse the vfunc isn't reported
+ # but the (physical) function is.
+ if x['vdevfn'] & AUTO_PHP_SLOT:
+ vdevfn = AUTO_PHP_SLOT
+ else:
+ vdevfn = x['vdevfn']
+ return (vdevfn << 32) | \
+ PCI_BDF(x['domain'], x['bus'], x['slot'], x['func'])
devs.sort(None, f)
has_vdevfn = False
vslot = PCI_SLOT(vdevfn)
for i in dev:
i['vdevfn'] = '0x%02x' % \
- PCI_DEVFN(vslot, PCI_FUNC(int(i['vdevfn'], 16)))
+ PCI_DEVFN(vslot, PCI_FUNC(int(i['vdevfn'], 16)))
for i in dev:
xm_pci_attach_one(dom, i)